import request from '@/utils/request'

export function getDepartments() {
  return request({
    url: '/company/department'
  })
}

// 获取部门负责人
export function getEmployeesSimple() {
  return request({
    url: '/sys/user/simple'
  })
}

// 获取部门详情
export function getDepartmentsDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

// 新增子部门
/**
 * @param {codePointAt,introduce,manger,name,pid} data
 * @returns
*/

export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

// 编辑子部门
// @param {codePointAt,introduce,manger,name,pid} data
// @returns

export function editDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}

export function delDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
